home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / PageMaker 6.5 SDK Mac / SourceCode / Includes / CIText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-18  |  15.2 KB  |  379 lines  |  [TEXT/CWIE]

  1. /***[f*****************************************************************
  2.  *    CITEXT.H    -- PageMaker Text Interface. 
  3.  *
  4.  *    Copyright 1996 (c) Adobe Systems, Inc. All Rights Reserved
  5.  *
  6.  *    
  7.  * $Revision:   1.9  $
  8.  *
  9.  *    
  10.  ***f]*****************************************************************/
  11.   
  12. #ifndef __CITEXT_H
  13. #define __CITEXT_H
  14.  
  15. #include "pmtypes.h"
  16. #include "CIObjectAccess.h"
  17.  
  18. //    Information about the contents of
  19. //    a PageMaker text hole object.
  20. //
  21. typedef struct _PMTextBlockInfo {
  22.     unsigned short    bNeedsComposing;
  23.     unsigned long    startCharNum;    // relative to whole story
  24.     unsigned long    startLineNum;    // relative to whole story
  25.     unsigned short    numChars;        // num chars in text block
  26.     unsigned short    numLines;        // num lines in text block
  27.     unsigned long    storyID;
  28.     unsigned long    indexInStory;    // order of text block in series
  29.                                     // of story's text blocks. First
  30.                                     // text block is index 1.
  31.     unsigned long    prevBlockID;    // ID of text block before this one
  32.     unsigned long    nextBlockID;    // ID of text block following this one
  33.                                     // To get the given text block's ID, use
  34.                                     // CIObjectAccess::GetObjID().
  35. } PMTextBlockInfo;
  36.  
  37. //    Information about a line (including linebreak)
  38. //
  39. typedef enum _PMLineBreakType {
  40.     PMLB_AutoWrapIntrusion, // autowrap intrusion
  41.     PMLB_Overset,            // text is overset
  42.     PMLB_Hard,                // hard line end (end of para.)
  43.     PMLB_Tab,                // break caused by tab
  44.     PMLB_Force                // forced line end (no para. end)
  45. } PMLineBreakType;
  46.  
  47. typedef struct _PMLineInfo {
  48.     unsigned long    nCharCount;
  49.     PMLineBreakType    cLineBreakType;
  50.     unsigned long    nLineHeight;
  51.     unsigned long    nComposeWidth;
  52.     unsigned long    nLineNumber;
  53.     unsigned long    endwithdischy : 1;    // lbrk ends with dischyish char
  54.     unsigned long    kernpairsexist : 1;    // pairkerning applied to lbrk
  55.     unsigned long    letterspacing : 1;    // set if lbrk was letterspaced
  56.     unsigned long    funnyhyphenation: 1;// for German, Swiss... 
  57.     unsigned long    endwithladder : 1;    // T = ends with ladder-rung char
  58.     unsigned long    needscomposing  : 1;// Set if line needs composing.
  59.     unsigned long    badwidth : 1;        // text is loose or tight
  60.     unsigned long    badkeep : 1;        // pagination broke a keep rule
  61.     unsigned long    graphic : 1;        // T = lbrk has in-line graphic
  62. } PMLineInfo;
  63.  
  64. //    Information about a story
  65. //
  66. typedef struct _PMStoryInfo {
  67.     unsigned long    nNumChars;
  68.     unsigned long    nNumLines;
  69.     unsigned long    nNumTxtBlock;
  70.     unsigned long    firstBlockID;    // ID of first text block before this one
  71. } PMStoryInfo;
  72.  
  73. #define PMFACENAMESIZE    64
  74. #define PMCOLORNAMESIZE 32
  75. #define PMSTYLENAMESIZE    32
  76.  
  77. //-----------------------------------------------------------
  78. // Character Format Information
  79. typedef struct _PMCharFormatInfo {
  80.     unsigned long nNumChars;        // number of chars in the text run
  81.     unsigned long nOffset;            // char offset relative to the current
  82.                                     // text run (based on the targetCharOffset
  83.                                     // (which is relative to the entire story).
  84.     char faceName[PMFACENAMESIZE];    // face name
  85.     unsigned short size;            // font size in tenth points
  86.                                     // (float fsize=size/10); 
  87.     short leading;                    // font leading in tenth points
  88.                                     // (float fleading=leading/10)
  89.                                     // -1 means auto leading
  90.     char colorName[PMCOLORNAMESIZE];// font color name
  91.                                     // style bits (bold, italic, etc.)
  92.     unsigned long plain : 1;        // none of the others
  93.     unsigned long bold : 1;            // bold
  94.     unsigned long italic : 1;        // italic
  95.     unsigned long underline : 1;    // underlined
  96.     unsigned long outline : 1;        // outline chars
  97.     unsigned long shadow : 1;        // drop shadow
  98.     unsigned long condense : 1;        // narrow chars
  99.     unsigned long extend : 1;        // wide chars
  100.     unsigned long hidden : 1;        // hidden text
  101.     unsigned long strickout : 1;    // struck-through
  102.     unsigned long superscript : 1;    // superscripted
  103.     unsigned long subscript : 1;    // subscripted
  104.     unsigned long allcaps : 1;        // all caps
  105.     unsigned long smallcaps : 1;    // small caps
  106.     unsigned long reverse : 1;        // reverse
  107.     short setwidth;                    // set pointsize (tenth points),
  108.                                     // or -1 for square
  109.                                     // tracking
  110.     unsigned short notrack : 1;
  111.     unsigned short verytight : 1;
  112.     unsigned short tight : 1;
  113.     unsigned short normal : 1;
  114.     unsigned short loose : 1;
  115.     unsigned short veryloose : 1;
  116.                                     // general character info
  117.     unsigned short isinline : 1;    // is inline graphics
  118.     unsigned short nobreak : 1;        // 1 if no breaks allowed in this run
  119.     short kernamt;                    // manual kern adjustment, in 1/1000th of em
  120.     unsigned short smcapsize;        // smallcap size, tenths of % of orig. font height
  121.     unsigned short supersubsize;    // sub/superscript size, tenths of % of font height
  122.     unsigned short subscriptpos;    // subscript pos, tenths of % of font height
  123.     unsigned short superscriptpos;    // superscript pos, tenths of % of font height
  124.     short baselineshift;            // baseline shift in signed twips
  125.     unsigned short objTintAmt;         // object-level tint value for the CFmt, 0=0%, 100=100%
  126. } PMCharFormatInfo;
  127.  
  128.  
  129. //-----------------------------------------------------------
  130. // Paragraph Format Information
  131. typedef enum _PMParaAlign {
  132.     PMPara_Left = 0,            // left justified (ragged right)
  133.     PMPara_Right = 1,            // right justified (ragged left)
  134.     PMPara_Center = 2,            // centered (ragged left and right) 
  135.     PMPara_Justify = 3,            // justified (no ragged)
  136.     PMPara_ForceJustify = 4        // force justified (justify all lines)
  137. } PMParaAlign;
  138.  
  139. typedef enum _PMHyphLevel {
  140.     PMHyph_Off=0,
  141.     PMHyph_Fair=1,
  142.     PMHyph_Good=2,
  143.     PMHyph_Best=3,
  144.     PMHyph_Manual=4
  145. } PMHyphLevel;
  146.  
  147. typedef enum _PMLeadMethod {
  148.     PMLead_None=0,
  149.     PMLead_Proportional=1,
  150.     PMLead_TopOfCaps=2,
  151.     PMLead_Baseline=3
  152. } PMLeadMethod;
  153.  
  154. typedef enum _PMLineStyle {
  155.     PMLine_Solid=0,
  156.     PMLine_ThinThin=1,
  157.     PMLine_ThickThin=2,
  158.     PMLine_ThinThick=3,
  159.     PMLine_ThinThickThin=4,
  160.     PMLine_ThinDash=5,
  161.     PMLine_Squares = 6,
  162.     PMLine_Dots = 7,
  163.     PMLine_None = 8
  164. } PMLineStyle;
  165.  
  166. /*      Structures within the PMParaFormatInfo, 
  167.  *      Note that 'gridit' (in flags) really applies to the line rather
  168.  *      than any individual rule.  The value of gridit should be the same
  169.  *      for both above and below.
  170.  */
  171. typedef struct _PMParaRule {
  172.     unsigned short ruleExists : 1;    // this rule exists/valid
  173.     unsigned short useTextWidth : 1;// TRUE - text width, F = column width
  174.     unsigned short gridIt : 1;        // TRUE - adjust line break depth for grid
  175.     unsigned short transparent : 1;    // TRUE if transparent, opaque otherwise.
  176.     PMLineStyle lineStyle;            // line style
  177.     unsigned short lineWeight;        // line weight in points (scaled by 10)
  178.     char colorName[PMCOLORNAMESIZE];// color name
  179.     unsigned short objTintAmt;        // Object-level tint
  180.     short leftOffset;        // offset from margin to left edge of rule
  181.     short rightOffset;        // offset from margin to right edge of rule    
  182.     short height;            // distance from text baseline to top/bot
  183.     
  184. } PMParaRule;
  185.  
  186. typedef struct _PMParaFormatInfo {
  187.     unsigned long nNumChars;    // number of chars in the text run
  188.     unsigned long nOffset;        // char offset relative to the current
  189.                                 // text run (based on the targetCharOffset
  190.                                 // (which is relative to the entire story).
  191.     char            styleName[PMSTYLENAMESIZE];    // style name
  192.     PMParaAlign        align;
  193.     PMHyphLevel        hyphenLevel;// hyphenation level
  194.     PMLeadMethod    leadMethod;    // leading method
  195.     char            languageName[64];
  196.     unsigned short    includeTOC : 1;    // 1 to include table of content, 0 otherwise
  197.     unsigned short    pairkern : 1;    // 1 is on, 0 is off
  198.     short            indleft;    // left indent in twips
  199.     short            indfirst;    // first line of paragraph indent in twips
  200.     short            indright;    // right indent in twips
  201.     short            spbefore;    // extra space before paragraph in twips
  202.     short            spafter;    // extra space after paragraph in twips
  203.     unsigned short    kernsize;    // size above which we must kern (scale by 10)
  204.                                 // real kern size is: float realsize = kernsize/10
  205.     short leadpct;                // Autolead percentage.
  206.     short minband;                // minimum spaceband width
  207.     short maxband;                // maximum spaceband width
  208.     short desband;                // desired spaceband width
  209.     short minltrsp;                // minimum letterspacing
  210.     short maxltrsp;                // maximum letterspacing
  211.     short desltrsp;                // desired letterspacing
  212.     short hotzone;                // hot zone width for ragged hyphenation in twips
  213.     unsigned short    maxhyphens;    // max consecutive hyphens allowed
  214.                                 // for keeps/breaks...
  215.     unsigned short    keepTogether:1;
  216.     unsigned short    keepColumnBreak:1;
  217.     unsigned short    keepPageBreak:1;
  218.     unsigned short    keepFollow:2;
  219.     unsigned short    keepWidow:2;
  220.     unsigned short    keepOrphan:2;
  221.     unsigned short    usegrid;    // leading for para's grid (twips), or NO_GRID
  222.     PMParaRule        ruleAbove;    // rule above info
  223.     PMParaRule        ruleBelow;    // rule below info
  224. } PMParaFormatInfo;
  225.  
  226. //-----------------------------------------------------------
  227. // Tab Format Information
  228. #define MAXTABS    40            // maximum number of tabs
  229.  
  230. typedef enum _PMTabAlign {
  231.     PMTab_Left=0,
  232.     PMTab_Right=1,
  233.     PMTab_Center=2,
  234.     PMTab_Decimal=3
  235. } PMTabAlign;
  236.  
  237. typedef struct _PMTabStop {
  238.     short pos;                // in Twips
  239.     PMTabAlign align;        // tab alignment
  240.     char leaderPair[2];        // tab leader pair
  241. } PMTabStop;
  242.  
  243. typedef struct _PMTabFormatInfo {
  244.     unsigned long nNumChars;    // number of chars in the text run
  245.     unsigned long nOffset;        // char offset relative to the current
  246.                                 // text run (based on the targetCharOffset
  247.                                 // (which is relative to the entire story).
  248.     unsigned long nNumTabs;        // number of tabs in tabStop
  249.     PMTabStop tabStop[MAXTABS];
  250. } PMTabFormatInfo;
  251. //-----------------------------------------------------------
  252.  
  253. #ifdef __cplusplus
  254.  
  255. class CIText : public CIInterface
  256. {
  257. public:    
  258.     virtual            ~CIText() {};
  259.  
  260.     // Return text hole information for the given object
  261.     virtual PMErr        GetTextBlockInfo(PMOBJ_REC* pObjRec, PMTextBlockInfo* pTextBlockInfo) = 0;
  262.     // Return line information for the given story and line number
  263.     virtual    PMErr        GetTextLineBreakInfo(unsigned long storyID, unsigned long lineNumber, PMLineInfo* pLineBreakInfo) = 0;
  264.     // Return information for the given story
  265.     virtual    PMErr        GetTextStoryInfo(unsigned long storyID, PMStoryInfo* pStoryInfo) = 0;
  266.     // Return the first inline graphic found in the given
  267.     // story's list of ILGs
  268.     // This returns all inline graphics--both "valid" and "invalid" ones.
  269.     // "Invalid" inlines are those that have not been drawn since they were
  270.      // moved or possibly moved or will have been moved by composition.
  271.     virtual    PMErr        GetStoryFirstILG(unsigned long storyID, PMOBJ_REC* pILGObjRec) = 0;
  272.     // Return the next inline graphic found in the given
  273.     // story's list of ILGs
  274.     virtual    PMErr        GetStoryNextILG(PMOBJ_REC* pILGObjRec) = 0;
  275.     // ReadStoryTextRaw
  276.     // Given a story ID and a text range (offset & numChars),
  277.     // return a pointer buffer of raw text in ppTextBuf and
  278.     // the size of the buffer in buffer size.
  279.     // The offset parameter specifies the character offset
  280.     // into the given story. Use an offset of 0 to start
  281.     // at the beginning of the story.
  282.     // The nFormat parameter is used as follows:
  283.     //    0 to keep all non-printing characters
  284.     //    1 to delete all non-printing characters
  285.     //    2 to replace all non-printing characters with spaces
  286.     //    3 to substitute all non-printing ASCII characters as 
  287.     //        text export filter does
  288.     //
  289.     // IMPORTANT NOTES:
  290.      // ReadStoryTextRaw() will allocate the memory for the text.
  291.     // When done with the buffer, the plug-in must call FreeTextMemory()!!!
  292.     // Any calls to any of the ReadStoryTextXXX() methods will
  293.     // automatically free any previously allocated memory!
  294.     virtual    PMErr        ReadStoryTextRaw(unsigned long storyID, unsigned short nFormat,
  295.                                     unsigned long offset, unsigned long numChars,
  296.                                     char** ppTextBuf, unsigned long* bufSize) = 0;
  297.     // ReadStoryTextTagged
  298.     // Given a story ID and a text range (offset & numChars),
  299.     // return a pointer buffer of tagged text in ppTextBuf and
  300.     // the size of the buffer in buffer size.
  301.     // The offset parameter specifies the character offset
  302.     // into the given story. Use an offset of 0 to start
  303.     // at the beginning of the story.
  304.     // The nFormat parameter is used as follows:
  305.     //    0 to keep all non-printing characters
  306.     //    1 to delete all non-printing characters
  307.     //    2 to replace all non-printing characters with spaces
  308.     //    3 to substitute all non-printing ASCII characters as 
  309.     //        text export filter does
  310.     //
  311.     // IMPORTANT NOTES:
  312.      // ReadStoryTextTagged() will allocate the memory for the text.
  313.     // When done with the buffer, the plug-in must call FreeTextMemory()!!!
  314.     // Any calls to any of the ReadStoryTextXXX() methods will
  315.     // automatically free any previously allocated memory!
  316.     virtual    PMErr        ReadStoryTextTagged(unsigned long storyID, unsigned short nFormat,
  317.                                         unsigned long offset, unsigned long numChars,
  318.                                         char** ppTextBuf, unsigned long* bufSize) = 0;
  319.     // ReadStoryTextRTF
  320.     // Given a story ID and a text range (offset & numChars),
  321.     // return a pointer buffer of RTF text in ppTextBuf and
  322.     // the size of the buffer in buffer size.
  323.     // The offset parameter specifies the character offset
  324.     // into the given story. Use an offset of 0 to start
  325.     // at the beginning of the story.
  326.     // The nFormat parameter is ignored by ReadStoryTextRTF.
  327.     //
  328.     // IMPORTANT NOTES:
  329.      // ReadStoryTextRTF() will allocate the memory for the text.
  330.     // When done with the buffer, the plug-in must call FreeTextMemory()!!!
  331.     // Any calls to any of the ReadStoryTextXXX() methods will
  332.     // automatically free any previously allocated memory!
  333.     virtual    PMErr        ReadStoryTextRTF(unsigned long storyID, unsigned short nFormat,
  334.                                     unsigned long offset, unsigned long numChars,
  335.                                     char** ppTextBuf, unsigned long* bufSize) = 0;
  336.     // FreeTextMemory
  337.     // Frees any text buffer allocated by one of the 
  338.     // ReadStoryTextXXX() methods.
  339.     virtual    void    FreeTextMemory() = 0;
  340.  
  341.     virtual PMErr    GetTextSelection(unsigned long *pBlockID, unsigned long *pStoryID, 
  342.                         unsigned long *pOffset, unsigned long *pNumChars ) = 0;
  343.  
  344.      // RecomposeAllStories is called when every story in the pub needs to be recomposed.
  345.     // Some text attributes are pub level, hence changing them requires recomposing
  346.     // everything
  347.     virtual void    RecomposeAllStories()=0;
  348.  
  349.     // Setup the inlines in the current story. Only operates on current page.
  350.     virtual void    SetupStoryInlines()=0;
  351.  
  352.      // RecomposeStory compose all stories on current page or to end of pub
  353.     // bEndofPub is FALSE, this function will compose all stories on 
  354.     // the current page that need recomposing, starting from the 1st 
  355.     // hole in the story through the last hole of the story on the page.  
  356.     // bEndofPub is TRUE, this will compose each story to the end of the pub
  357.     virtual void    RecomposeStory(BOOL bEndofPub)=0;
  358.  
  359.     virtual PMErr    GetCharFormatInfo(unsigned long storyID, long targetCharOffset, 
  360.                                 PMCharFormatInfo *pCharFormatInfo)=0;
  361.  
  362.     virtual PMErr    GetParaFormatInfo(unsigned long storyID, long targetCharOffset,
  363.                                 PMParaFormatInfo *pParaFormatInfo)=0;
  364.  
  365.     virtual PMErr    GetTabFormatInfo(unsigned long storyID, long targetCharOffset,
  366.                                 PMTabFormatInfo *pTabFormatInfo)=0;
  367.  
  368.     virtual PMErr    GetLineBreakInfo(unsigned long storyID, long targetCharOffset,
  369.                                 PMLineInfo *pLineInfo)=0;
  370.  
  371.     virtual PMErr    GetStyleNameInfo(char *pStyleName, PMTabFormatInfo *pTabFormatInfo,
  372.                                 PMParaFormatInfo *pParaFormatInfo,
  373.                                 PMCharFormatInfo *pCharFormatInfo)=0;
  374. } ;
  375.  
  376. #endif    // __cplusplus
  377.  
  378. #endif
  379.